#ifndef __FILTERN_H_
#define __FILTERN_H_

#include "stdint.h"

#ifdef __cplusplus
extern "C"
{
#endif

   int i16_maxmin_get(int16_t *dat, uint16_t Len, uint16_t *pmax_index, uint16_t *pmin_index);
   int u16_maxmin_get(uint16_t *dat, uint16_t Len, uint16_t *pmax_index, uint16_t *pmin_index);
   int i32_maxmin_get(int32_t *dat, uint16_t Len, uint16_t *pmax_index, uint16_t *pmin_index);
   int u32_maxmin_get(uint32_t *dat, uint16_t Len, uint16_t *pmax_index, uint16_t *pmin_index);

   int16_t i16_average(int16_t *dat, uint16_t Len);
   uint16_t u16_average(uint16_t *dat, uint16_t Len);
   int32_t i32_average(int32_t *dat, uint16_t Len);
   uint32_t u32_average(uint32_t *dat, uint16_t Len);

   int16_t i16_average_nminmax(int16_t *dat, uint16_t Len);
   uint16_t u16_average_nminmax(uint16_t *dat, uint16_t Len);
   int32_t i32_average_nminmax(int32_t *dat, uint16_t Len);
   uint32_t u32_average_nminmax(uint32_t *dat, uint16_t Len);

   int16_t i16_middle_filter(int16_t *dat, uint16_t Len);
   uint16_t u16_middle_filter(uint16_t *dat, uint16_t Len);
   int32_t i32_middle_filter(int32_t *dat, uint16_t Len);
   uint32_t u32_middle_filter(uint32_t *dat, uint16_t Len);

   int32_t i32_middle_average_filter(int32_t *dat, uint16_t Len, uint16_t CutLen);
   uint32_t u32_middle_average_filter(uint32_t *dat, uint16_t Len, uint16_t CutLen);
   int16_t i16_middle_average_filter(int16_t *dat, uint16_t Len, uint16_t CutLen);
   uint16_t u16_middle_average_filter(uint16_t *dat, uint16_t Len, uint16_t CutLen);

   uint32_t u32_coef_filter(uint32_t *dat, uint16_t *coef, uint16_t StartIndex, uint16_t Len);
   uint16_t u16_coef_filter(uint16_t *dat, uint16_t *coef, uint16_t StartIndex, uint16_t Len);

   typedef struct
   {
      float out_order1; 
      float out_order2; 
      float out_order3; 
   } f_order_filter_type;
   
   float f_order_filter(f_order_filter_type *flt, float new_data, float flt_coef); 

#ifdef __cplusplus
}
#endif

#endif 
